<%#encoding:UTF-8%><%
slevel = @level.zero? && @special ? 1 : @level
anchor = link_start = link_end = nil
if @id
  if @document.attr? :sectanchors
    anchor = %(<a class="anchor" href="##{@id}"></a>)
  elsif @document.attr? :sectlinks
    link_start = %(<a class="link" href="##{@id}">)
    link_end = '</a>'
  end
end
if slevel.zero?
  %><h1<%= @id && %( id="#{@id}") %> class="sect0"><%= %(#{anchor}#{link_start}#{title}#{link_end}) %></h1>
<!--div class="title"><%= title %></div-->
<%= content %><%
else
  snum = @numbered && @caption.nil? && slevel <= (@document.attr 'sectnumlevels', 3).to_i ? %(#{sectnum} ) : nil
  hlevel = slevel == 1 ? 3 : slevel + 1
  cols = slevel <= 2 ? "columns medium-12" : ""
  marginFix = slevel <= 2 ? "style='padding-left: 0;'" : ""

  %><div <%= @id && %( id="#{@id}") %> class="<%= [%(sect#{slevel}),role].compact * ' ' %> <%= cols %>" <%= marginFix %> >
<h<%= hlevel %>><%= %(#{anchor}#{link_start}#{snum}#{captioned_title}#{link_end}) %></h<%= hlevel %>>
<%= content %>
</div><%
end %>
